package com.game;

public class Computer extends Role {


    public int generate() {
        //出拳范围0剪刀，1布，2石头 随机生成
        int number;
        number = generateCode(0, 2);
        switch (number) {
            case 0:
                System.out.println("电脑:出剪刀");
                break;
            case 1:
                System.out.println("电脑:出布");
                break;
            case 2:
                System.out.println("电脑:出石头");
                break;
        }
        return number;
    }

    public int generateCode(int start, int end) {
        return (int) (Math.random() * (end - start + 1) + start);
    }

}
